$(document).ready(function(){
	$(window).load(function(){
		
		$('.btn1').click(function(){
		var sign=$('.sheep3-2').html().substring(1,$('.sheep3-2').html().length);
		var sign1=$('.txt').val();
		var sign2=$('.sheep4').html().substring(1,$('.sheep4').html().length);
		
			sign1++;
			$('.txt').val(sign1)
			$('.sheep4').html('￥'+parseInt(sign)*sign1)
			$('.surname').html('￥'+parseInt(sign)*sign1)
		})
		
		$('.btn').click(function(){
		var sign=$('.sheep3-2').html().substring(1,$('.sheep3-2').html().length);
		var sign1=$('.txt').val();
		var sign2=$('.sheep4').html().substring(1,$('.sheep4').html().length);
			sign1--;
			if(sign1<1){sign1=1}
			$('.txt').val(sign1)
			$('.sheep4').html('￥'+parseInt(sign)*sign1)
			$('.surname').html('￥'+parseInt(sign)*sign1)
		})
		
		
		
	$('.sheep5').click(function(){
			
		$('.cart0,.sheet').remove();
		$('.show,.shoo').show()
		})
	$('.sheep6-left3').click(function(){
		$('.cart0,.sheet').remove();
		$('.show,.shoo').show()
	})
	
		
//		var car1=$('.cart1').val();
//		onoff=true;
//		$('.cart1').click(function(){
//		if(onoff){
//			$('.car,sheep3-10,sheep6-left1').val(car1)
//		}else{
//			$('.car,sheep3-10,sheep6-left1').val()
//		}
//		onoff=!onoff;
//		})
		
		
		function setCookies(key,value,iDays){
		var day= new Date();
		day.setDate(day.getDate()+iDays);
		document.cookie= key+ "="+ value+";expires="+day+";path=/";
	  }
	 function getCookie(key){
	    var str = document.cookie;  
		var arr = str.split("; ");
		for(var i=0;i<arr.length;i++){
		  var arr2= arr[i].split("=");  
		  if(key==arr2[0]){
		    return arr2[1]
		  }
		}
		return "";
	  }
		function main(){

			var name=getCookie("keep");
		  	var price=getCookie("keep1");
		  	var num=getCookie("amount");
		  	var src=getCookie("keep3");
		  	
		  	$('.sheep3-1 dt img').attr('src',src);
			$('.sheep3-1 dd a').text(name)
			$('.sheep3-3-1 .txt').val(num)
		  	$('.sheep3-2').text(price)
		  	
		  	$('.surname').html(price);
		  	
		  	var aa='￥'+(num*parseFloat(price.substring(1,price.length)))
		  	$('.sheep4').text(aa)
		  	$('.surname').text(aa)
		  	$('.unitv span').text(aa)
		  	$('.unitvall span').text(aa)
		  	$('.unitvalqw span').text(aa)
		  	
		  	
		}
		
	main()
		
//		$('.sheep6-right2').click(function(){
//			setCookies("sheep3-1 dt img",$('.sheep3-1 dt img').attr('src'),10);
//			setCookies("sheep3-1 dd a",$(".sheep3-1 dd a").text(),10);
//			setCookies("sheep3-2",$(".sheep3-2").text(),10);
//			setCookies(sheep3-3-1 .txt,$(".sheep3-3-1 .txt").val(),10);
//			
//			
//		  	
//		  	
//		  	
//		})
		
		
		
		
		
		
		
		
		
		
	})
	
})
